//
//  CoreTextController1.m
//  TangQiao
//
//  Created by 宜必鑫科技 on 2017/10/16.
//  Copyright © 2017年 宜必鑫科技. All rights reserved.
//

#import "CoreTextController1.h"
#import "CTDisplayView.h"
#import "CTFrameParserConfig.h"
#import "CTFrameParser.h"
@interface CoreTextController1 ()
@property (nonatomic, strong) CTDisplayView *ctView1;
@end

@implementation CoreTextController1

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    UIScrollView *scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 64, WIDTH, HEIGHT - 64)];
    [self.view addSubview:scrollView];

#pragma mark - 我的不显示图片？？？？？？？？？？？？
    // 需要给每一段字体制定颜色和大小  以及其他属性
    _ctView1 = [[CTDisplayView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT)];
    [scrollView addSubview:_ctView1];
    
    CTFrameParserConfig *config1 = [[CTFrameParserConfig alloc]init];
    config1.width = self.ctView1.width;
    
    //获取模板文件
    NSString *path = [[NSBundle mainBundle] pathForResource:@"JsonTemplate" ofType:@"json"];
    
    //创建绘制数据实例
    CoreTextData *data1 = [CTFrameParser parseTemplateFile:path config:config1];
    _ctView1.data = data1;
    _ctView1.height = data1.height;
    _ctView1.backgroundColor = [UIColor yellowColor];
    scrollView.contentSize = CGSizeMake(WIDTH, data1.height);
}

@end
